<!-- 标签商品 -->
<template>
  <div
    class="content"
    :style="{
      'background-color': config.ConfigData.bgcolor,
      margin: '0 ' + config.ConfigData.margin + 'px',
      padding: '0 ' + config.ConfigData.padding + 'px',
      'border-radius': config.ConfigData.parentradius + 'px'
    }"
  >
    <div
      :class="['tabtitle', { tab1: config.DataList.length === 1 }]"
      v-if="showtitle"
    >
      <div v-for="(item, iindex) in config.DataList" :key="iindex">
        <div
          :data-com-index="iindex"
          :style="{
            width: 666 / config.DataList.length + 'px',
            color: config.ConfigData.taglist[iindex].selected
              ? config.ConfigData.selectcolor
              : config.ConfigData.defaultccolor,
            'border-bottom-color': config.ConfigData.taglist[iindex].selected
              ? config.ConfigData.selectcolor
              : config.ConfigData.defaultccolor
          }"
          :class="[
            'tabtitle_item',
            config.ConfigData.taglist[iindex].selected
              ? 'tabtitle_item_select'
              : ''
          ]"
        >
          <div class="tagtext">{{ item.Name }}</div>
        </div>
      </div>
    </div>
    <div class="shop_item" v-if="config.ConfigData.showtype === 1">
      <div v-for="(item, iindex) in config.DataList" :key="iindex">
        <div v-if="config.ConfigData.taglist[iindex].selected">
          <div
            class="list"
            :style="{
              'background-color': config.ConfigData.itembgcolor,
              margin: '20px ' + config.ConfigData.itemmargin + 'px',
              'border-radius': config.ConfigData.itemradius + 'px'
            }"
            v-for="(item, index) in config.ConfigData.taglist[iindex]
              .ProductInfoList"
            :key="index"
          >
            <div class="image_box">
              <img
                :style="{ 'border-radius': config.ConfigData.radius + 'px' }"
                mode="aspectFill"
                :src="item.DefaultImageUrl | getgalleryImg('P450')"
              />
            </div>
            <div class="goods">
              <div
                class="product_name"
                :style="{ color: config.ConfigData.titlecolor }"
              >
                {{ item.ProductName | subStr(28) }}
              </div>
              <!-- <div class="series">{{item.Spec==null?'':item.Spec}}</div> -->
              <!-- <div class="series">{{item.ProductNote==null?'':item.ProductNote}}</div> -->
              <div
                class="price"
                :style="{ color: config.ConfigData.pricecolor }"
              >
                {{ item.SalePrice | getProductPrice }}
              </div>
              <!-- <div class="product_info"> -->
              <!-- <div class="cost_price">￥{{item.marketPrice}}</div> -->
              <!-- </div> -->
            </div>
          </div>
        </div>
        <div
          class="list"
          :style="{ margin: '20px ' + config.ConfigData.itemmargin + 'px' }"
          v-if="
            config.ConfigData.taglist[iindex].selected &&
              config.ConfigData.taglist[iindex].ProductInfoList.length % 2 === 1
          "
        ></div>
      </div>
    </div>
    <div v-if="config.ConfigData.showtype === 2">
      <div v-for="(item, iindex) in config.DataList" :key="iindex">
        <div v-if="config.ConfigData.taglist[iindex].selected">
          <div
            class="goods-info"
            :style="{
              'background-color': config.ConfigData.itembgcolor,
              'margin-top': config.ConfigData.itemmargin + 'px',
              'border-radius': config.ConfigData.itemradius + 'px'
            }"
            v-for="(item, index) in config.ConfigData.taglist[iindex]
              .ProductInfoList"
            :key="index"
          >
            <div class="img-box">
              <img
                :style="{ 'border-radius': config.ConfigData.radius + 'px' }"
                lazy-load
                mode="aspectFill"
                :src="item.DefaultImageUrl | getgalleryImg('P450')"
                class="img"
              />
            </div>
            <div class="text-box">
              <div
                class="goods-title"
                :style="{ color: config.ConfigData.titlecolor }"
              >
                {{ item.ProductName }}
              </div>
              <!-- <div class="goods-label">{{item.Spec==null?'':item.Spec}}</div> -->
              <div
                class="goods-label"
                :style="{ color: config.ConfigData.desccolor }"
              >
                {{ item.ProductNote == null ? "" : item.ProductNote }}
              </div>
              <div
                class="goods-price"
                :style="{ color: config.ConfigData.pricecolor }"
              >
                {{ item.SalePrice | getProductPrice }}
              </div>
              <!-- <div class="goods-dingjin">定金￥{{item.SalePrice}}</div> -->
            </div>
          </div>
        </div>
      </div>
    </div>
    <div v-if="config.ConfigData.showtype === 3">
      <div v-for="(item, iindex) in config.DataList" :key="iindex">
        <div v-if="config.ConfigData.taglist[iindex].selected">
          <div
            hover-class="none"
            class="taggoodsinfotype3"
            :style="{
              'background-color': config.ConfigData.itembgcolor,
              margin: '20px ' + config.ConfigData.itemmargin + 'px',
              'border-radius': config.ConfigData.itemradius + 'px'
            }"
            v-for="(item, index) in config.ConfigData.taglist[iindex]
              .ProductInfoList"
            :key="index"
          >
            <img
              :style="{ 'border-radius': config.ConfigData.radius + 'px' }"
              lazy-load
              mode="aspectFill"
              :src="item.DefaultImageUrl | getgalleryImg('P750')"
              class="img"
            />
            <div class="text-box">
              <div class="goodsinfotype3content">
                <div
                  class="goods-title"
                  :style="{ color: config.ConfigData.titlecolor }"
                >
                  {{ item.ProductName | subStr(31) }}
                </div>
                <div
                  class="goods-price"
                  :style="{ color: config.ConfigData.pricecolor }"
                >
                  {{ item.SalePrice | getProductPrice }}
                </div>
              </div>
              <div
                class="goods-label"
                :style="{ color: config.ConfigData.desccolor }"
              >
                {{ item.ProductNote ? item.ProductNote : "" }}
              </div>
              <!-- <div class="goods-dingjin">定金￥{{item.SalePrice}}</div> -->
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "TagProductCopt",
  props: {
    config: Object,
    showtitle: {
      default: true,
      type: Boolean
    }
  },
  data() {
    return {};
  },
  methods: {
    tabtap(index, e) {
      this.config.ConfigData.taglist.map(e => {
        e.selected = false;
      });
      this.config.ConfigData.taglist[index].selected = true;
    }
  },
  mounted() {}
};
</script>

<style lang="scss" scoped>
.content {
  padding: 0 10px;
  .tab1 {
    justify-content: center !important;
  }
  .tabtitle {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
    .tabtitle_item {
      text-align: center;
      font-size: 26px;
      font-family: "PingFang-SC-Medium";
      font-weight: 500; //height: 70px;
      color: #222;
      line-height: 70px;
      overflow: hidden;
      .tagtext {
        display: inline-block;
        text-align: left;
      }
    }
    .tabtitle_item_select {
      color: #277dfd;
      border-bottom-style: solid;
      border-bottom-width: 6px;
      border-bottom-color: #277dfd; // .tagtext {
      //   border-bottom: 6px solid #277dfd;
      // }
    }
  }
  .shop_item {
    padding: 0px;
    justify-content: center;
    background: transparent;
    display: flex;
    flex-wrap: wrap;
    padding-bottom: 30px;
    margin-top: 30px;
  }
  .list {
    background: transparent; //width: 336px;
    margin-bottom: 20px;
    margin: 20px 20px;
    width: 44%;
    .image_box {
      img {
        height: 250px;
      }
    }
    .product_name {
      font-size: 24px;
      font-family: "PingFang-SC-Medium";
      font-weight: 500;
      color: rgba(34, 34, 34, 1);
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 1;
      -webkit-box-orient: vertical;
      word-break: break-all;
    }
    .price {
      font-family: "PingFang-SC-Regular";
      font-weight: 400;
      color: rgba(249, 58, 38, 1);
      font-size: 24px;
    }
    .cost_price {
      color: rgba(249, 58, 38, 1);
      font-size: 24px;
      text-decoration: line-through;
      font-weight: 600;
    }
    .sale_num {
      color: #666666;
      font-size: 22px;
    }
    .goods {
      padding: 10px;
      .series {
        font-size: 22px;
        color: #999999;
        padding-top: 8px;
        text-overflow: -o-ellipsis-lastline;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        align-content: center;
      }
    }
    .product_info {
      padding-top: 5px;
      display: flex;
      justify-content: space-between;
      flex-direction: row;
      align-items: flex-end;
      width: 334px;
    }
    .cost_price {
      padding-left: 20px;
    }
    .sale_num {
      padding-left: 20px;
    }
  }
  .goods-info {
    height: 200px;
    background: transparent;
    border-radius: 10px;
    display: flex;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    .img-box {
      width: 160px;
      height: 160px;
      border-radius: 10px;
      overflow: hidden;
      margin-right: 19px;
      background-color: transparent;
    }
    .text-box {
      width: 480px;
      .goods-title {
        font-size: 30px;
        font-family: "PingFang-SC-Bold";
        font-weight: 500;
        color: rgba(34, 34, 34, 1);
        line-height: 40px;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
      }
      .goods-label {
        font-size: 24px;
        font-family: "PingFang-SC-Regular";
        font-weight: 400;
        color: rgba(153, 153, 153, 1);
        margin: 8px 0 11px 0;
        overflow: hidden;
        height: 30px;
      }
      .goods-price {
        font-family: "PingFang-SC-Medium";
        font-weight: 500;
        font-size: 30px;
        color: rgba(249, 58, 38, 1);
      }
      .goods-dingjin {
        font-family: "PingFang-SC-Medium";
        font-weight: 500;
        font-size: 24px;
        color: rgba(249, 58, 38, 1);
      }
      .buy-num {
        line-height: 48px;
        position: absolute;
        right: 29px;
        bottom: 37px;
        display: flex;
        font-size: 24px;
        text-align: center;
      }
    }
  }
  .goods-info .img-box .img {
    width: 160px;
    height: 160px;
  }
  .taggoodsinfotype3 {
    //height: 580px;
    margin-bottom: 50px;
    text-align: center;
    .img {
      // width: 686px;
      height: 430px;
      border-radius: 10px;
    }
    .text-box {
      display: flex;
      flex-direction: column;
      margin-top: 15px;
      text-align: left;
      padding-left: 20px;
      .goodsinfotype3content {
        display: flex;
        flex-direction: row;
        .goods-title {
          font-size: 30px;
          font-family: "PingFang-SC-Bold";
          font-weight: 500;
          color: rgba(34, 34, 34, 1);
          width: 100%; // overflow: hidden;
        }
        .goods-price {
          font-size: 30px;
          font-family: "PingFang-SC-Bold";
          font-weight: bold;
          color: rgba(249, 58, 38, 1);
        }
      }
      .goods-label {
        margin-top: 20px;
        font-size: 24px;
        font-family: "PingFang-SC-Regular";
        font-weight: 400;
        color: rgba(153, 153, 153, 1);
        width: 100%;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }
    }
  }
}
</style>
